<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.blockchain.front.servlets.SendEmailCode"%>
<%@page import="com.blockchain.front.servlets.security.Smrz"%>
<%@page import="com.blockchain.front.servlets.Send"%>
<%@page import="com.blockchain.front.servlets.security.Qbbz"%>
<%@page import="com.blockchain.front.service.financial.entity.XlbEntity"%>
<%@page import="com.blockchain.util.http.URLParameter"%>
<%@page import="com.blockchain.front.servlets.financial.AbstractFinancialServlet"%>
<%@page import="com.blockchain.front.service.AbstractFrontService"%>
<%@page import="com.blockchain.front.servlets.AbstractFrontServlet"%>
<%@page import="com.blockchain.front.service.financial.entity.JlEntity"%>
<%@page import="com.blockchain.common.enums.JyztStatus"%>
<%@page import="com.blockchain.front.service.security.entity.QbdzEntity"%>
<%@page import="com.blockchain.front.service.security.SecurityManage"%>
<%@page import="com.blockchain.front.service.financial.FinancialManage"%>
<html>
<head>
<%
String str = languageDefine.getValue(request, "turnOut_turnOut");
String _TITLE_ = str + "- "+configureProvider.getProperty(SystemVariable.SITE_NAME);
CURRENT_SUB_CATEGORY="ZCXLB";
PC_TITLE_NAME="ZCXLB";
URLParameter parameter = new URLParameter(request,controller.getViewURI(request,XlbZc.class));
SecurityManage securityManage = serviceSession.getService(SecurityManage.class);
QbdzEntity[] qbdzs=securityManage.getZcXlbxx();
int bid=IntegerParser.parse(request.getParameter("bid"));
FinancialManage manage=serviceSession.getService(FinancialManage.class);

if (bid <= 0) {
	bid = manage.getzcbid();
}
int qbid=IntegerParser.parse(request.getParameter("qbid"));
UserManage usanage=serviceSession.getService(UserManage.class);
final int currentPage = IntegerParser.parse(request.getParameter("paging.current"));
 PagingResult<XlbEntity> searchXlbzc=manage.searchXlbZc(bid,new Paging() {
	public int getCurrentPage() {
		return currentPage;
	}

	public int getSize() {
		return 10;
	}
});
XlbEntity[] search=searchXlbzc.getItems(); //列表
BigDecimal ky=manage.getKyXlb(bid);//可用虚拟币
QbdzEntity[] lists=securityManage.qbdzList(bid);//地址
XlbEntity xx=manage.getXlbXx(bid);//虚拟币详情
User us=usanage.getUser();
int zbxe=manage.getZbDbzg();
%> 
<title><%=_TITLE_ %></title>
<%@include file="/WEB-INF/include/meta.jsp"%>
<%@include file="/WEB-INF/include/style.jsp"%>
<%@include file="/WEB-INF/include/authenticatedSession.jsp"%>
</head>
<%@include file="/WEB-INF/include/header.jsp"%>
<div class="autobox">
 <div class="now">
  <a href="<%=controller.getViewURI(request, com.blockchain.front.servlets.Index.class)%>" class="orange"><%=languageDefine.getValue(request, "menu_home")%></a> &gt; <a href="<%=controller.getViewURI(request,com.blockchain.front.servlets.financial.index.class)%>" class="orange"><%=languageDefine.getValue(request, "menu_financeCenter")%> </a> &gt; <%=languageDefine.getValue(request, "turnOut_turnOut")%>
 </div>
 	<div class="assets_center clear po_re zin70">
  <%@include file="/WEB-INF/include/financial/left.jsp"%>	
   <div class="assets_content w900 right bg_w">
            <div class="safe_center clear" style="padding-left: 0px;">
                <h1 style="margin-top: 0px; margin-bottom: 15px; line-height: 15px;"><%=languageDefine.getValue(request, "turnOut_turnOut")%></h1>
            </div>
            <div class="sj" style="top: 40px; left: 72px;"></div>
			 <form action="<%=controller.getURI(request, XlbZc.class)%>" method="post" id="form" >
			 <input type="hidden" name="phone" value="<%=us.iphone%>">
            <div id="coin_active" class="weituo_bizhong">
                <div class="bizhong_select">
                    <div class="bz_btn">
                        <img src="<%if(!StringHelper.isEmpty(securityManage.getTbZrzc(bid,2))){%><%=fileStore.getURL(securityManage.getTbZrzc(bid,2))%><%}%>" alt="" style="width: 22px; float: left; margin-top: 7px; margin-right: 5px;"/>
                        <span id="coin-default"> 
                        <select name="bid" id="myzc_type" style="margin-top: 7px;">
                        <%if(qbdzs!=null){for(QbdzEntity q:qbdzs){ if("cny".equalsIgnoreCase(q.ywjc)) continue;%>
                          <option value="<%=q.id%>" <%if(q.id==bid){%> selected="selected"<%}%>><%StringHelper.filterHTML(out,q.zwm);%> (<%StringHelper.filterHTML(out,q.ywjc);%> )</option>
                         <%}}%>
                         </select>
    				  </span>
                    </div>
                </div>
                <div class="bizhong_type" style="width: 220px;">
                    <span><%=languageDefine.getValue(request, "turnOut_available")%><em class="coin-name"></em>：<font class="coin-balance"><%=Formater.formatAmount_(ky,4)%></font></span>

                </div>
            </div>
            <div class="mytips">
            <h6 style="color: #ff8000;"><%=languageDefine.getValue(request, "xlbzcnNoticeTitle")%></h6>
            <p style="font-size:14px;">
                <span style="color:#E53333;">
	                1、 单笔转出最低<%=Formater.formatAmount(xx.min_xz)%><%StringHelper.filterHTML(out,xx.ywm);%>，最高<%=Formater.formatAmount(xx.max_xz)%><%StringHelper.filterHTML(out,xx.ywm);%>。<br>
	                2、 转出手续为转出数量的<%=Formater.formatAmount(xx.max_sxfl.multiply(new BigDecimal(100)))%>%，<%=Formater.formatAmount(xx.min_sxf)%><%StringHelper.filterHTML(out,xx.ywm);%>。<br>
	                3、 正常情况下1个工作日到账，最多不超过3个工作日，节假日顺延。<br>
	                
            </span>
            
 
            </p>
        	</div>
            <div class="choosepaymethod">
                <div class="choosebanks" style="margin-top: 20px;">
                        <div class="methodway clearfix">
                            <div class="w_div clearfix">
                                <div class="w1"><%=languageDefine.getValue(request, "turnOut_turnOutAddress")%>：</div>
                                <div class="w2">
                             		 <%if(lists!=null){%>
                                    <select name="qbid" id="myzc_addr" style="width: 200px; height: 38px;border-radius: 8px;">
                                        <option value="tianjia">----<%=languageDefine.getValue(request, "turnOut_addAddress")%>----</option>
                                        <%if(lists!=null){for(QbdzEntity qb:lists){ %>
                                        <option value="<%=qb.id%>" <%if(qb.id==qbid){%> selected="selected"<%}%>><%StringHelper.filterHTML(out,qb.bq);%></option>
                                        <%}}%>
                                    </select>
                                   <%}else{%> 
         							<a href="<%=controller.getViewURI(request,Qbbz.class)%>" style="line-height: 36px;color:#0d66bf;"><%=languageDefine.getValue(request, "turnOut_addOneAddress")%></a>
        							<%}%>
                                </div>
                            </div>
                            <div class="w_div clearfix">
                                <div class="w1"><%=languageDefine.getValue(request, "turnOut_turnOutQuantity")%>：</div>
                                <div class="w2 po_re">
                                    <input type="text" name="sl" class="cztxinput" id="nums" value="" style="border-radius: 8px;">
                                </div>
                            </div>
                            <div class="w_div clearfix">
                                <div class="w1"><%=languageDefine.getValue(request, "turnOut_smsVerificationCode")%>：</div>
                                <div class="w2">
                                   <input type="text" class="cztxinput" id="moble_verify" value="" style="width: 70px;border-radius: 8px;" name="zcxlbverifyCode">
                                  <input id="regBtn" type="button" class="getyzm" value='<%=languageDefine.getValue(request, "turnOut_getFreeVerificationCode")%>' onclick="SendCode(this);" style="width: 108px;height: 35px;" maxlength="4"> 
                                 <span style="color:#EA6647;"><%=languageDefine.getValue(request, "turnOut_receiveSmsPhone")%><%StringHelper.truncationMpno(out, us.iphone);%></span>
                                </div>
                            </div>
                            <div class="w_div clearfix">
                                <div class="w1"><%=languageDefine.getValue(request, "turnOut_tradePassword")%>：</div>
                                <div class="w2">
                                    <input type="password" name="jymm" class="cztxinput" id="paypassword" value="" style="border-radius: 8px;">
                                </div>
                            </div>
                            <div class="w_div clearfix">
                                <div class="w1">&nbsp;</div>
                                <div class="w2">
                                    <input type="button" class="btn-cztx" id="cztxSubmit" onclick="Update()" value='<%=languageDefine.getValue(request, "turnOut_submit")%>' title='<%=languageDefine.getValue(request, "turnOut_submit")%>' style="border-radius: 8px;">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="f_body">
                    <table class="f_table" id="investLog_content">
                        <thead>
                        <tr>
                            <th width=""><%=languageDefine.getValue(request, "turnOut_turnOutTime")%></th>
                            <th width=""><%=languageDefine.getValue(request, "turnOut_turnOutCurrency")%></th>
                            <th width=""><%=languageDefine.getValue(request, "turnOut_receiveAddress")%></th>
                            <th width=""><%=languageDefine.getValue(request, "turnOut_turnOutQuantity")%></th>
                            <th width=""><%=languageDefine.getValue(request, "turnOut_turnOutFee")%></th>
                            <th width=""><%=languageDefine.getValue(request, "turnOut_actualArrial")%></th>
                            <th width=""><%=languageDefine.getValue(request, "turnOut_ifTurnOut")%></th>
                        </tr>
                        </thead>
                        <tbody>
                 <%if(search!=null){for(XlbEntity s:search){%> 
            	<tr>
                <td><%=TimestampParser.format(s.sj)%></td>
                <td><%StringHelper.filterHTML(out,s.zwm);%>(<%StringHelper.filterHTML(out,s.ywm);%>)</td>
                <td><%StringHelper.filterHTML(out,s.jsdz);%></td>
                <td><%=Formater.formatAmount_6(s.zcsl.add(s.sxf))%></td>
                <td><%=Formater.formatAmount_6(s.sxf)%></td>
                <td><%=Formater.formatAmount_6(s.zcsl)%></td>
                <td><%=backgroundDataFlag==1?s.isPass.getName():backgroundDataFlag==2?s.isPass.getNameEn():s.isPass.getNameTw()%></td>
            </tr>
            <%}}%>
               </tbody>
                    </table>
       			<%AbstractFinancialServlet.rendPaging(out, searchXlbzc,controller.getPagingURI(request,XlbZc.class),parameter.getQueryString());%>
                </div>
            </div>
            </form> 
        </div>
 </div>
</div>

<%@include file="/WEB-INF/include/footer.jsp"%>
<%@include file="/WEB-INF/include/script.jsp"%>
<script type="text/javascript">
$(function(){
<%-- 	<%if(StringHelper.isEmpty(us.name)||StringHelper.isEmpty(us.zjh)){%>	
	layer.open({  
	         content: '<%=languageDefine.getValue(request, "js_notVerified")%>',  
	         btn: ['<%=languageDefine.getValue(request, "js_confirm")%>'],  
	         yes: function(index, layero) {  
	         window.location.href='<%=controller.getViewURI(request, Smrz.class)%>';  
	         },  
	        cancel: function() {  
	       	window.location.href='<%=controller.getViewURI(request, Smrz.class)%>';  
	         }  
	     }); 
	<%}%>

<%if(!usanage.gjsmrz()){%>	
	layer.open({  
         content: '<%=languageDefine.getValue(request, "js_notSuperVerified")%>',  
         btn: ['<%=languageDefine.getValue(request, "js_confirm")%>'],  
         yes: function(index, layero) {  
         window.location.href='<%=controller.getViewURI(request, Smrz.class)%>';  
         },  
        cancel: function() {  
       	window.location.href='<%=controller.getViewURI(request, Smrz.class)%>';  
         }  
     }); 
<%}%> --%>
});


var _cUrl = '<%=controller.getURI(request, SendEmailCode.class)%>';
var min_xz=<%=xx.min_xz%>;
var max_xz=<%=xx.max_xz%>;
var phone='<%=us.iphone%>';
var wait = 60;
	$("#myzc_type").change(function () {
	$("#form").attr("action",'<%=controller.getViewURI(request, XlbZc.class)%>');	
    $("#form").submit();
});
	$("#myzc_addr").change(function () {
	        var type = $("#myzc_addr option:selected").val();
	        if (type == 'tianjia') {
	            window.location = '<%=controller.getViewURI(request, Qbbz.class)%>';
		}
	});
	function Update() {
	        var addr = $('#myzc_addr option:selected').val();
	        var num = $("#nums").val();
	        var moble_verify = $("#moble_verify").val();
	        var paypassword = $("#paypassword").val();

	        if (addr == "" || addr == null||addr=='tianjia') {
	            layer.tips('<%=languageDefine.getValue(request, "js_chooseWallet")%>', '#myzc_addr', {tips: 3});
	            return false;
	        }

	        if (num == "" || num == null) {
	            layer.tips('<%=languageDefine.getValue(request, "js_turnOutQuantity")%>', '#nums', {tips: 3});
	            return false;
	        }
	        if(num>max_xz){
	        	layer.tips('<%=languageDefine.getValue(request, "js_turnOutMax")%>'+max_xz+'', '#nums', {tips: 3});
	            return false;
	        }
	        if(num<min_xz){
	        	layer.tips('<%=languageDefine.getValue(request, "js_turnOutMin")%>'+min_xz+'', '#nums', {tips: 3});
	            return false;
	        }

	        if (moble_verify == "" || moble_verify == null) {
	            layer.tips('<%=languageDefine.getValue(request, "js_smsVerificationCode")%>', '#moble_verify', {tips: 3});
	            return false;
	        }

	        if (paypassword == "" || paypassword == null) {
	            layer.tips('<%=languageDefine.getValue(request, "js_tradePassword")%>', '#paypassword', {tips: 3});
	            return false;
	        }
	        
	        $("#form").submit();  
	    }
	
	function SendCode(evn){
		sendclick(evn);
		var data={"type":"XLBZC","phone":phone};
		 $.ajax({
			type:"post",
			dataType:"html",
			url:_cUrl,
			data:data,
			success:function(data){
				var ct = eval('('+data+')');
					if(ct[0].num == 2){
					}else{
					layer.tips(ct[0].msg, '#moble_verify', {tips: 2});
					return false;
					}
				}
		});  
	}
	 function sendclick(evn){
		 var obj = $('#regBtn');
		 if (wait == 0) {
				obj.val('<%=languageDefine.getValue(request, "js_getCaptcha")%>');
	            obj.css('background','#0d66bf');
	            obj.removeAttr("disabled");
				wait = 60;
			} else {
				$('#regBtn').css('background','#999B9C');
				$('#regBtn').val(wait + '<%=languageDefine.getValue(request, "js_sendAgain")%>');
	             wait--;
				  setTimeout(function() {
					sendclick(evn);
				},1000); 
			}
		}	
	
<%String error = controller.getPrompt(request,response,PromptLevel.ERROR);if(!StringHelper.isEmpty(error)){%>
	layer.open({
	title: '<%=languageDefine.getValue(request, "js_tip")%>',
	content: '<%=languageDefine.getValue(request,error)%>'
});  
<%}%>
<%String info = controller.getPrompt(request,response,PromptLevel.INFO);if(!StringHelper.isEmpty(info)){%>
layer.open({
title: '<%=languageDefine.getValue(request, "js_tip")%>',
content: '<%=info%>'
});  
<%}%>
</script>
</body>
</html>	
	
